package com.qk.management.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.qk.common.PageResult;
import com.qk.domain.operateLog.OperateLogDO;
import com.qk.dto.operateLog.OperateLogDTO;
import com.qk.entity.OperateLog;
import com.qk.management.mapper.OperateLogMapper;
import com.qk.management.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;


@Slf4j
@Service
@SuppressWarnings("all")
public class OperateLogServiceImpl extends ServiceImpl<OperateLogMapper, OperateLog> implements OperateLogService {



    @Override
    public PageResult<OperateLogDO> listLog(OperateLogDTO dto) {
        PageHelper.startPage(dto.getPage(), dto.getPageSize());


        List<OperateLogDO> operateLog = this.baseMapper.selectLog(dto);

        Page<OperateLogDO> page = (Page<OperateLogDO>) operateLog;
        return PageResult.<OperateLogDO>builder()
                .total(Long.valueOf(page.getTotal()).intValue())
                .rows(page.getResult())
                .build();
    }
}